﻿<%@ Page Language="C#" MasterPageFile="~/User/NhanVien.master" AutoEventWireup="true"
    Theme="Default" CodeFile="NhapHang.aspx.cs" Inherits="User_NhapHang" Title="Lập phiếu nhập hàng" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div id="content_t">
        &nbsp;</div>
    <div id="content">
        <div align="center" id="form">
            <h3>
                Lập phiếu nhập hàng</h3>
            <asp:Table runat="server" SkinID="Table" ID="tblThem">
                <asp:TableHeaderRow SkinID="TableHeaderRow">
                    <asp:TableHeaderCell>Tên sản phẩm</asp:TableHeaderCell>
                    <asp:TableHeaderCell>Nhà cung cấp</asp:TableHeaderCell>
                    <asp:TableHeaderCell>
                        Số lượng<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtSoLuong"
                            ErrorMessage="*"></asp:RequiredFieldValidator>
                        <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="*" ControlToValidate="txtSoLuong"
                            MaximumValue="9999999" MinimumValue="1"></asp:RangeValidator></asp:TableHeaderCell>
                    <asp:TableHeaderCell>
                        Đơn giá<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtDonGia"
                            ErrorMessage="*"></asp:RequiredFieldValidator>
                        <asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="txtDonGia"
                            ErrorMessage="*" MaximumValue="9999999" MinimumValue="1"></asp:RangeValidator></asp:TableHeaderCell>
                </asp:TableHeaderRow>
                <asp:TableRow>
                    <asp:TableCell SkinID="TableCell">
                        <asp:DropDownList CssClass="TextBox" ID="cmbTenSP" runat="server" Width="200px">
                        </asp:DropDownList>
                    </asp:TableCell>
                    <asp:TableCell SkinID="TableCell">
                        <asp:DropDownList CssClass="TextBox" ID="cmbTenNCC" runat="server" Width="200px">
                        </asp:DropDownList>
                    </asp:TableCell>
                    <asp:TableCell SkinID="TableCell">
                        <asp:TextBox CssClass="TextBox AlignRight" ID="txtSoLuong" runat="server" Width="100px">0</asp:TextBox></asp:TableCell>
                    <asp:TableCell SkinID="TableCell">
                        <asp:TextBox CssClass="TextBox AlignRight" ID="txtDonGia" runat="server" Width="100px">0</asp:TextBox></asp:TableCell>
                </asp:TableRow>
                <asp:TableFooterRow SkinID="TableFooterRow">
                    <asp:TableHeaderCell ColumnSpan="4">
                        <asp:Button ID="btnThemSP" runat="server" OnClick="btnThemSP_Click" Text="Thêm Sản Phẩm" />
                    </asp:TableHeaderCell>
                </asp:TableFooterRow>
            </asp:Table>
        </div>
        <asp:Label ID="Label1" runat="server" Text="Label" Visible="False"></asp:Label>
        <span style="padding:10px;"><asp:Label ID="Label2" runat="server" Text="Danh sách sản phẩm vừa nhập:"></asp:Label></span>
        <div align="center" id="list">
            <asp:GridView SkinID="GridView" ID="gvSanPham" runat="server" AutoGenerateColumns="False"
                Width="902px" OnRowCommand="gvSanPham_RowCommand" OnRowDeleting="gvSanPham_RowDeleting"
                AllowPaging="True">
                <Columns>
                    <asp:BoundField DataField="masp" HeaderText="Mã sản phẩm">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:BoundField>
                    <asp:BoundField DataField="tensp" HeaderText="Tên sản phẩm">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="200px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="tenncc" HeaderText="Nhà cung cấp">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="200px" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="Số lượng">
                        <ItemTemplate>
                            <asp:TextBox CssClass="TextBox AlignRight" ID="gv_soluong" runat="server" Text='<%# Eval("soluong") %>'
                                Width="60px"></asp:TextBox>
                        </ItemTemplate>
                        <ControlStyle Width="100px" />
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Đơn giá">
                        <ItemTemplate>
                            <asp:TextBox CssClass="TextBox AlignRight" ID="gv_dongia" runat="server" Text='<%# Eval("dongia") %>'
                                Width="100px"></asp:TextBox>
                        </ItemTemplate>
                        <ControlStyle Width="100px" />
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:TemplateField>
                    <asp:ButtonField CommandName="CapNhat" Text="Cập nhật">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:ButtonField>
                    <asp:CommandField ShowDeleteButton="True" DeleteText="Xóa" />
                </Columns>
            </asp:GridView>
            <br />
        </div>
        <div align="right">
            Tổng tiền:<asp:Label ID="lbTongTien" runat="server" Text="0"></asp:Label><br /> 
            <asp:Button ID="btnNhapHang" runat="server" Text="Lưu phiếu nhập hàng" OnClick="btnNhapHang_Click"
                CausesValidation="False" />
        </div>
    </div>
    <div id="content_b">
        &nbsp;</div>
</asp:Content>
